package com.pengchuang.ACS.face.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.pengchuang.ACS.face.entity.HomeEntity;
import com.pengchuang.ACS.face.service.HomeService;
import com.pengchuang.ACS.common.utils.PageUtils;
import com.pengchuang.ACS.common.utils.R;



/**
 * 
 *
 * @author pengchaung
 * @email pengshi12138@outlook.com
 * @date 2023-03-16 21:25:07
 */
@RestController
@RequestMapping("face/home")
public class HomeController {
    @Autowired
    private HomeService homeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = homeService.queryPage(params);

        return R.ok().put("result", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		HomeEntity home = homeService.getById(id);

        return R.ok().put("result", home);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody HomeEntity home){
		homeService.save(home);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody HomeEntity home){
		homeService.updateById(home);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		homeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
